<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style></style>
  </head>
  <body>
    <div id="myDiv"></div>
    <script>
      var box = document.getElementById("myDiv");
      console.log(box);
      if (box.nodeName === "DIV") {
        console.log("是div");
      } else {
        console.log("不是div");
      }
      if (box.tagName === "DIV") {
        console.log("是div");
      } else {
        console.log("不是div");
      }
    </script>
  </body>
</html>
